package com.best.guanfengji

import android.app.Application
import com.best.guanfengji.serial_port.SerialPortCommand
import com.best.guanfengji.serial_port.SerialPortManager
import java.io.File
import kotlin.properties.Delegates

/**
 * author: shihao
 * date: 2021/1/13 13:33
 * description:
 */
class App : Application() {

    companion object {
        var instance: App by Delegates.notNull()

        fun instance() = instance
    }

    override fun onCreate() {
        super.onCreate()
        instance = this
        //打开串口
        SerialPortManager.instance.openSerialPort(File("/dev/ttyS3"))
        SerialPortManager.instance.sendStringData(SerialPortCommand.SETTING_ADDRESS_5A)//设置本机ID
        SerialPortManager.instance.sendStringData("F3F8F5F5F11F")//串口通信回环测试
    }
}